package svc

import (
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"zk/product_zy17/api/internal/config"
	"zk/product_zy17/api/internal/middleware"
	"zk/product_zy17/productRpc/productrpcclient"
)

type ServiceContext struct {
	Config              config.Config
	ProRpc              productrpcclient.ProductRpc
	UserAgentMiddleware rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config: c,
		ProRpc: productrpcclient.NewProductRpc(
			zrpc.MustNewClient(c.ProRpc)),
		UserAgentMiddleware: middleware.NewUserAgentMiddleware().Handle,
	}
}
